//
//  LCZPicCell.m
//  PersonalNews
//
//  Created by dllo on 15/11/30.
//  Copyright © 2015年 changshuhua. All rights reserved.
//

#import "LCZPicCell.h"
#import "New.h"
#define WIDTH [UIScreen mainScreen].bounds.size.width
#define HEIGHT [UIScreen mainScreen].bounds.size.height
#define TABAR 44
#define HEADERHIHT 64

@implementation LCZPicCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self createCell];
    }
    return self;
}

- (void)createCell{
    self.titleLabel = [[UILabel alloc] init];
    [self.contentView addSubview:self.titleLabel];
    self.titleLabel.font = [UIFont systemFontOfSize: 0.04589371980676 * WIDTH];
 
    self.imgsrcImageView = [[UIImageView alloc] init];
    [self.contentView addSubview:self.imgsrcImageView];
    
    self.imgsrcImageView1 = [[UIImageView alloc] init];
    [self.contentView addSubview:self.imgsrcImageView1];
    
    self.imgsrcImageView2 = [[UIImageView alloc] init];
    [self.contentView addSubview:self.imgsrcImageView2];
    
    self.grayView = [[LCZBaseView alloc]init];
    [self.contentView addSubview:self.grayView];
}


-(void)layoutSubviews{
    [super layoutSubviews];
    self.titleLabel.frame = CGRectMake(WIDTH * 0.0242, WIDTH * 0.02899, self.frame.size.width - WIDTH * 0.048301, WIDTH * 0.0725 + 5);
    self.titleLabel.numberOfLines = 0;
    [_titleLabel sizeToFit];
    //    self.imgsrcImageView.frame = CGRectMake(WIDTH * 0.0242, WIDTH * 0.0725, (self.frame.size.width - WIDTH * 0.09662) / 3 , WIDTH * 0.1932);
    //    self.imgsrcImageView1.frame = CGRectMake(WIDTH * 0.048301 + (self.frame.size.width - WIDTH * 0.09662) / 3, WIDTH * 0.0725, (self.frame.size.width - WIDTH * 0.09662) / 3 , WIDTH * 0.1932);
    //    self.imgsrcImageView2.frame = CGRectMake(WIDTH * 0.0725 + 2 *(self.frame.size.width - WIDTH * 0.09662) / 3, WIDTH * 0.0725, (self.frame.size.width - WIDTH * 0.09662) / 3 , WIDTH * 0.1932);
    CGFloat i = self.titleLabel.frame.size.height;
    self.imgsrcImageView.frame = CGRectMake(WIDTH * 0.0242, i + 15 + 5, (self.frame.size.width - WIDTH * 0.09662) / 3 , WIDTH * 0.1932);
    self.imgsrcImageView1.frame = CGRectMake(WIDTH * 0.048301 + (self.frame.size.width - WIDTH * 0.09662) / 3, i + 15 + 5, (self.frame.size.width - WIDTH * 0.09662) / 3 , WIDTH * 0.1932);
    self.imgsrcImageView2.frame = CGRectMake(WIDTH * 0.0725 + 2 *(self.frame.size.width - WIDTH * 0.09662) / 3, i + 15 + 5, (self.frame.size.width - WIDTH * 0.09662) / 3 , WIDTH * 0.1932);
    
    self.grayView.frame = CGRectMake(0, self.contentView.frame.size.height - 4, self.contentView.frame.size.width, 4);
    self.grayView.backgroundColor = [UIColor colorWithRed:0.88 green:0.89 blue:0.9 alpha:1];
}
- (void)getDate:(New *)news{
    [self.imgsrcImageView2 sd_setImageWithURL:[NSURL URLWithString:news.imgsrc] placeholderImage:[UIImage imageNamed:@"0.jpg"]];
    self.titleLabel.text = news.title;
    
    //        new.imgsrc =  news.imgextra[0][@"imgsrc"];
    NSDictionary *dic = news.imgextra[0];
    news.imgsrc1 = dic[@"imgsrc"];
    [self.imgsrcImageView sd_setImageWithURL:[NSURL URLWithString:news.imgsrc1] placeholderImage:[UIImage imageNamed:@"0.jpg"]];
    NSDictionary *dic1 = news.imgextra[1];
    news.imgsrc2 = dic1[@"imgsrc"];
    [self.imgsrcImageView1 sd_setImageWithURL:[NSURL URLWithString:news.imgsrc2] placeholderImage:[UIImage imageNamed:@"0.jpg"]];
}

- (void)getDateWithRecomend:(ReadRecommend *)recommend{
    
}
- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}


@end
